package guda.house.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.house.dal.dao.InvoiceLogDAO;
import guda.house.dal.dataobject.InvoiceLogDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class InvoiceLogDAOImpl extends BaseDAO implements InvoiceLogDAO {

    @Override
	public Long insert(InvoiceLogDO invoiceLog) {
	      try {
                return (Long) getSqlMapperW().insert("invoice_log.insert",invoiceLog);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public InvoiceLogDO getInvoiceLogById(Long logId) {
	    return (InvoiceLogDO)getSqlMapClientTemplate().queryForObject("invoice_log.getInvoiceLogById", logId);
	}

    @Override
	public boolean delInvoiceLogById(Long logId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("invoice_log.delInvoiceLogById",logId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<InvoiceLogDO> getInvoiceLogByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("invoice_log.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long logId) {
	    try {
            getSqlMapperW().update("invoice_log.cleanAutoIncrement",logId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<InvoiceLogDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("invoice_log.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("invoice_log.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(InvoiceLogDO invoiceLog) {
        try {
            getSqlMapperW().update("invoice_log.updateByIdSelective",invoiceLog);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }



}

